﻿using DtoFw;
using DtoFw.Interface;
using DtoFw.Query;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SceneEvidenceAPISDK
{
    public class ApiRoom : Base, IRoom
    {
        /// <summary>
        /// 移除区域
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BaseResult DeleteArea(DeleteSingleDto query)
        {
            return HttpTools.Delete<BaseResult>(query,
                 base.GetApiRouter("DeleteArea"));
        }
        /// <summary>
        /// 批量移除箱子
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BaseResult DeleteBoxs(DeleteDto query)
        {
            return HttpTools.Delete<BaseResult>(query,
                base.GetApiRouter("DeleteBoxs"));
        }
        /// <summary>
        /// 移除柜子
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BaseResult DeleteCabinet(DeleteSingleDto query)
        {
            return HttpTools.Delete<BaseResult>(query,
                 base.GetApiRouter("DeleteCabinet"));
        }
        /// <summary>
        /// 添加区域
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public BaseResult PostArea(AreaPostDto dto)
        {
            return HttpTools.Post<BaseResult>(dto,
                 base.GetApiRouter("PostArea"));
        }
        /// <summary>
        /// 添加箱子
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public BaseResult PostBox(BoxPostDto dto)
        {
            return HttpTools.Post<BaseResult>(dto,
                 base.GetApiRouter("PostBox"));
        }
        /// <summary>
        /// 添加柜子
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public BaseResult PostCabinet(CabinetPostDto dto)
        {
            return HttpTools.Post<BaseResult>(dto,
                 base.GetApiRouter("PostCabinet"));
        }
        /// <summary>
        /// 修改区域
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public BaseResult PutArea(AreaPutDto dto)
        {
            return HttpTools.Put<BaseResult>(dto,
                 base.GetApiRouter("PutArea"));
        }
        /// <summary>
        /// 修改箱子
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public BaseResult PutBox(BoxPutDto dto)
        {
            return HttpTools.Put<BaseResult>(dto,
              base.GetApiRouter("PutBox"));
        }
        /// <summary>
        /// 修改柜子
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public BaseResult PutCabinet(CabinetPutDto dto)
        {
            return HttpTools.Put<BaseResult>(dto,
                  base.GetApiRouter("PutCabinet"));
        }
        /// <summary>
        /// 查询区域
        /// </summary>
        /// <returns></returns>
        public BaseGenericResult<List<AreaQueryDto>> QueryAreas()
        {
            return HttpTools.Get<BaseGenericResult<List<AreaQueryDto>>>(base.GetApiRouter("QueryAreas"));
        }
        /// <summary>
        /// 查询箱子
        /// </summary>
        /// <param name="areaId"></param>
        /// <param name="cabinetId"></param>
        /// <returns></returns>
        public BaseGenericResult<List<CabinetQueryDto>> QueryBoxs(long areaId, long cabinetId)
        {
            string url = base.GetApiRouter("QueryBoxs");
            url = url.Replace("{params}", areaId.ToString()).Replace("{params1}", cabinetId.ToString());
            return HttpTools.Get<BaseGenericResult<List<CabinetQueryDto>>>(url);
        }
        /// <summary>
        /// 查询箱子
        /// </summary>
        /// <param name="areaId"></param>
        /// <returns></returns>
        public BaseGenericResult<List<CabinetQueryDto>> QueryCabinets(long areaId)
        {
            return HttpTools.Get<BaseGenericResult<List<CabinetQueryDto>>>(base.GetApiRouter("QueryCabinets",
                areaId.ToString()));
        }
    }
}
